{{- $name := .Get 0 }}
{{- $id := partialCached "functions/escape-html-id" $name $name }}
{{- if eq .Inner "" }}{{ end }}
{{- $items := sort (.Page.Store.Get (printf "toggle-%s-items" $name)) "Weight" }}
<ul class="nav nav-tabs toggle" id="toggle-{{ $name }}" role="tablist">
  {{- range $i, $item := $items }}
    {{- $itemID := partialCached "functions/escape-html-id" $item.Name $item.Name }}
    <li class="nav-item" role="presentation">
      <button
        class="nav-link{{ if eq $i 0 }} active{{ end }}"
        id="toggle-{{ $id }}-{{ $itemID }}-tab"
        data-bs-toggle="tab"
        data-bs-target="#toggle-{{ $id }}-{{ $itemID }}-tab-pane"
        type="button"
        role="tab"
        aria-controls="toggle-{{ $id }}-{{ $itemID }}-tab-pane"
        aria-selected="{{ cond (eq $i 0) `true` `false` }}">
        {{ $item.Name }}
      </button>
    </li>
  {{- end }}
</ul>
<div class="tab-content mb-3" id="toggle-{{ $name }}-content">
  {{- range $i, $item := $items }}
    {{- $itemID := partialCached "functions/escape-html-id" $item.Name $item.Name }}
    <div
      class="tab-pane fade{{ if eq $i 0 }} show active{{ end }}"
      id="toggle-{{ $id }}-{{ $itemID }}-tab-pane"
      role="tabpanel"
      aria-labelledby="toggle-{{ $id }}-{{ $itemID }}-tab"
      tabindex="0">
      {{ $item.Inner }}
    </div>
  {{- end }}
</div>

